reduce snapshot churn and speed up HistoryId lookups#486
Draft
ConstantinHvber wants to merge 1 commit intojust-every:mainfrom
Draft
reduce snapshot churn and speed up HistoryId lookups#486ConstantinHvber wants to merge 1 commit intojust-every:mainfrom
ConstantinHvber wants to merge 1 commit intojust-every:mainfrom
Conversation
Implement the “testlagfix” work to address long-session TUI lag and history-state mismatch degradation.
- Fix 1: throttle non-forced history snapshot persistence (reduce full snapshot rewrite frequency during
rapid UI/progress updates)
- Fix 2: add a lazy HistoryId→cell-index cache with dirty tracking + self-healing lookups; throttle
“history-state mismatch” warnings; adjust tool-card/running-tool resolution to use the new lookup; add
regression test to keep the index consistent under churn
- Fix startup panic: route the “Connecting MCP servers…” notice through the background helper (avoid
inserting BackgroundEvent via “prelude” path) and remove the now-unused helper
- Cleanup: remove non-Linux cgroup stubs and adjust spawn/exec cfg blocks to eliminate macOS warnings
- Version bump: set build/package version to 0.6.29-testlagfix (Rust workspace + codex-cli npm metadata)
There was a problem hiding this comment.
Pull request overview
This PR addresses TUI performance degradation during long sessions by implementing a lazy HistoryId-to-cell-index cache with dirty tracking and self-healing lookups, throttling history snapshot persistence, and fixing a startup panic related to MCP server connection notices.
Key Changes:
- Added a lazy HistoryId→cell-index HashMap cache with dirty tracking and automatic rebuild/self-healing to speed up history cell lookups
- Throttled non-forced history snapshot persistence from 400ms to 5 seconds to reduce I/O during rapid UI updates
- Fixed startup panic by routing "Connecting MCP servers…" notice through the background helper instead of creating a special-case BackgroundEventCell
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| code-rs/tui/src/history_cell/mod.rs | Removed unused new_connecting_mcp_status() helper function |
| code-rs/tui/src/chatwidget/tools.rs | Reformatted tool resolution fallback chain for clarity |
| code-rs/tui/src/chatwidget/running_tools.rs | Changed resolve_entry_index to take &mut ChatWidget to enable cache lookups |
| code-rs/tui/src/chatwidget.rs | Implemented HistoryId index cache with dirty tracking, updated all insert/replace/remove operations to maintain index consistency, throttled snapshot persistence and mismatch warnings, added comprehensive test coverage |
| code-rs/core/src/spawn.rs | Removed non-Linux cgroup stub declaration to eliminate macOS warnings |
| code-rs/core/src/exec.rs | Refactored cgroup cleanup into platform-specific blocks to eliminate warnings |
| code-rs/core/src/cgroup.rs | Removed non-Linux cgroup stub functions, consolidated platform-specific code under cfg attributes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement fixes to address long-session TUI lag and history-state mismatch degradation.